{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "c3bd1e23-6a3f-4a9b-b8e5-3ddb529b5426",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-12T07:41:57.939639Z",
     "iopub.status.busy": "2024-11-12T07:41:57.939110Z",
     "iopub.status.idle": "2024-11-12T07:41:59.470280Z",
     "msg_id": "fba9f9e0-da87-4909-918c-c62e27d44197",
     "shell.execute_reply": "2024-11-12T07:41:59.469309Z",
     "shell.execute_reply.started": "2024-11-12T07:41:57.939606Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Found existing installation: pandas 2.2.2\n",
      "Uninstalling pandas-2.2.2:\n",
      "  Successfully uninstalled pandas-2.2.2\n"
     ]
    }
   ],
   "source": [
    "# 必须将 pandas  版本升至 2.2.2\n",
    "!pip uninstall pandas -y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "96ed4b4c-1251-43e3-893b-b356fdca43f3",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-12T07:42:15.626022Z",
     "iopub.status.busy": "2024-11-12T07:42:15.625517Z",
     "iopub.status.idle": "2024-11-12T07:42:15.629829Z",
     "msg_id": "46d74c19-0543-4ea3-b7b9-c11720827c3c",
     "shell.execute_reply": "2024-11-12T07:42:15.629089Z",
     "shell.execute_reply.started": "2024-11-12T07:42:15.625988Z"
    }
   },
   "outputs": [],
   "source": [
    "!pip install pandas==2.2.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "85f88996-cf08-4a53-b102-247e38229134",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-12T07:41:45.929280Z",
     "iopub.status.busy": "2024-11-12T07:41:45.928736Z",
     "iopub.status.idle": "2024-11-12T07:41:50.171082Z",
     "msg_id": "c06ba813-a25f-4c5a-9d09-fecaefd41ebe",
     "shell.execute_reply": "2024-11-12T07:41:50.170027Z",
     "shell.execute_reply.started": "2024-11-12T07:41:45.929244Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/mole/.local/lib/python3.9/site-packages/pandas/core/computation/expressions.py:21: UserWarning: Pandas requires version '2.8.4' or newer of 'numexpr' (version '2.8.1' currently installed).\n",
      "  from pandas.core.computation.check import NUMEXPR_INSTALLED\n",
      "/home/mole/.local/lib/python3.9/site-packages/pandas/core/arrays/masked.py:60: UserWarning: Pandas requires version '1.3.6' or newer of 'bottleneck' (version '1.3.4' currently installed).\n",
      "  from pandas.core import (\n"
     ]
    },
    {
     "ename": "AttributeError",
     "evalue": "module 'pandas.core.strings' has no attribute 'StringMethods'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[3], line 16\u001b[0m\n\u001b[1;32m     13\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmodel_selection\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m KFold, StratifiedKFold\n\u001b[1;32m     14\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mfeature_selection\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m RFECV\n\u001b[0;32m---> 16\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mlightgbm\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mlgb\u001b[39;00m \n\u001b[1;32m     17\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlightgbm\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m log_evaluation, early_stopping\n\u001b[1;32m     18\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mxgboost\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mxgb\u001b[39;00m \n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/lightgbm/__init__.py:9\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[38;5;124;03m\"\"\"LightGBM, Light Gradient Boosting Machine.\u001b[39;00m\n\u001b[1;32m      3\u001b[0m \n\u001b[1;32m      4\u001b[0m \u001b[38;5;124;03mContributors: https://github.com/microsoft/LightGBM/graphs/contributors.\u001b[39;00m\n\u001b[1;32m      5\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m      7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpathlib\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Path\n\u001b[0;32m----> 9\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbasic\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Booster, Dataset, Sequence, register_logger\n\u001b[1;32m     10\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcallback\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m EarlyStopException, early_stopping, log_evaluation, record_evaluation, reset_parameter\n\u001b[1;32m     11\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mengine\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CVBooster, cv, train\n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/lightgbm/basic.py:22\u001b[0m\n\u001b[1;32m     19\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n\u001b[1;32m     20\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mscipy\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01msparse\u001b[39;00m\n\u001b[0;32m---> 22\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcompat\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m     23\u001b[0m     PANDAS_INSTALLED,\n\u001b[1;32m     24\u001b[0m     PYARROW_INSTALLED,\n\u001b[1;32m     25\u001b[0m     arrow_cffi,\n\u001b[1;32m     26\u001b[0m     arrow_is_boolean,\n\u001b[1;32m     27\u001b[0m     arrow_is_floating,\n\u001b[1;32m     28\u001b[0m     arrow_is_integer,\n\u001b[1;32m     29\u001b[0m     concat,\n\u001b[1;32m     30\u001b[0m     dt_DataTable,\n\u001b[1;32m     31\u001b[0m     pa_Array,\n\u001b[1;32m     32\u001b[0m     pa_chunked_array,\n\u001b[1;32m     33\u001b[0m     pa_ChunkedArray,\n\u001b[1;32m     34\u001b[0m     pa_compute,\n\u001b[1;32m     35\u001b[0m     pa_Table,\n\u001b[1;32m     36\u001b[0m     pd_CategoricalDtype,\n\u001b[1;32m     37\u001b[0m     pd_DataFrame,\n\u001b[1;32m     38\u001b[0m     pd_Series,\n\u001b[1;32m     39\u001b[0m )\n\u001b[1;32m     40\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mlibpath\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m find_lib_path\n\u001b[1;32m     42\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m TYPE_CHECKING:\n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/lightgbm/compat.py:152\u001b[0m\n\u001b[1;32m    150\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdask\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01marray\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m from_delayed \u001b[38;5;28;01mas\u001b[39;00m dask_array_from_delayed\n\u001b[1;32m    151\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdask\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbag\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m from_delayed \u001b[38;5;28;01mas\u001b[39;00m dask_bag_from_delayed\n\u001b[0;32m--> 152\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdask\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdataframe\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m DataFrame \u001b[38;5;28;01mas\u001b[39;00m dask_DataFrame\n\u001b[1;32m    153\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdask\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdataframe\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Series \u001b[38;5;28;01mas\u001b[39;00m dask_Series\n\u001b[1;32m    154\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdask\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdistributed\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Client, Future, default_client, wait\n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/dask/dataframe/__init__.py:3\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m      2\u001b[0m     \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mbase\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m compute\n\u001b[0;32m----> 3\u001b[0m     \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m backends, dispatch, rolling\n\u001b[1;32m      4\u001b[0m     \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m      5\u001b[0m         DataFrame,\n\u001b[1;32m      6\u001b[0m         Index,\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m     12\u001b[0m         to_timedelta,\n\u001b[1;32m     13\u001b[0m     )\n\u001b[1;32m     14\u001b[0m     \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mgroupby\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Aggregation\n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/dask/dataframe/backends.py:23\u001b[0m\n\u001b[1;32m     20\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdask\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01msizeof\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m SimpleSizeof, sizeof\n\u001b[1;32m     22\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m is_arraylike, typename\n\u001b[0;32m---> 23\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m DataFrame, Index, Scalar, Series, _Frame\n\u001b[1;32m     24\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdispatch\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m     25\u001b[0m     categorical_dtype_dispatch,\n\u001b[1;32m     26\u001b[0m     concat,\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m     36\u001b[0m     union_categoricals_dispatch,\n\u001b[1;32m     37\u001b[0m )\n\u001b[1;32m     38\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mextensions\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m make_array_nonempty, make_scalar\n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/dask/dataframe/core.py:52\u001b[0m\n\u001b[1;32m     50\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m methods\n\u001b[1;32m     51\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m_compat\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m PANDAS_GT_140, PANDAS_GT_150\n\u001b[0;32m---> 52\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01maccessor\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m DatetimeAccessor, StringAccessor\n\u001b[1;32m     53\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcategorical\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CategoricalAccessor, categorize\n\u001b[1;32m     54\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdispatch\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m     55\u001b[0m     get_parallel_type,\n\u001b[1;32m     56\u001b[0m     group_split_dispatch,\n\u001b[1;32m     57\u001b[0m     hash_object_dispatch,\n\u001b[1;32m     58\u001b[0m     meta_nonempty,\n\u001b[1;32m     59\u001b[0m )\n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/dask/dataframe/accessor.py:112\u001b[0m\n\u001b[1;32m    101\u001b[0m \u001b[38;5;250m    \u001b[39m\u001b[38;5;124;03m\"\"\"Accessor object for datetimelike properties of the Series values.\u001b[39;00m\n\u001b[1;32m    102\u001b[0m \n\u001b[1;32m    103\u001b[0m \u001b[38;5;124;03m    Examples\u001b[39;00m\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m    106\u001b[0m \u001b[38;5;124;03m    >>> s.dt.microsecond  # doctest: +SKIP\u001b[39;00m\n\u001b[1;32m    107\u001b[0m \u001b[38;5;124;03m    \"\"\"\u001b[39;00m\n\u001b[1;32m    109\u001b[0m     _accessor_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdt\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 112\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mStringAccessor\u001b[39;00m(Accessor):\n\u001b[1;32m    113\u001b[0m \u001b[38;5;250m    \u001b[39m\u001b[38;5;124;03m\"\"\"Accessor object for string properties of the Series values.\u001b[39;00m\n\u001b[1;32m    114\u001b[0m \n\u001b[1;32m    115\u001b[0m \u001b[38;5;124;03m    Examples\u001b[39;00m\n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m    118\u001b[0m \u001b[38;5;124;03m    >>> s.str.lower()  # doctest: +SKIP\u001b[39;00m\n\u001b[1;32m    119\u001b[0m \u001b[38;5;124;03m    \"\"\"\u001b[39;00m\n\u001b[1;32m    121\u001b[0m     _accessor_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstr\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
      "File \u001b[0;32m~/.local/lib/python3.9/site-packages/dask/dataframe/accessor.py:124\u001b[0m, in \u001b[0;36mStringAccessor\u001b[0;34m()\u001b[0m\n\u001b[1;32m    121\u001b[0m _accessor_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstr\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m    122\u001b[0m _not_implemented \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mget_dummies\u001b[39m\u001b[38;5;124m\"\u001b[39m}\n\u001b[0;32m--> 124\u001b[0m \u001b[38;5;129m@derived_from\u001b[39m(\u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstrings\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mStringMethods\u001b[49m)\n\u001b[1;32m    125\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21msplit\u001b[39m(\u001b[38;5;28mself\u001b[39m, pat\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, n\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m, expand\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m):\n\u001b[1;32m    126\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m expand:\n\u001b[1;32m    127\u001b[0m         \u001b[38;5;28;01mif\u001b[39;00m n \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m:\n",
      "\u001b[0;31mAttributeError\u001b[0m: module 'pandas.core.strings' has no attribute 'StringMethods'"
     ]
    }
   ],
   "source": [
    "import pandas as pd \n",
    "import numpy as np \n",
    "import os \n",
    "import gc\n",
    "import warnings\n",
    "warnings.filterwarnings(\"ignore\")\n",
    "\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.ensemble import GradientBoostingClassifier\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import roc_curve\n",
    "from sklearn.model_selection import KFold, StratifiedKFold\n",
    "from sklearn.feature_selection import RFECV\n",
    "\n",
    "import lightgbm as lgb \n",
    "from lightgbm import log_evaluation, early_stopping\n",
    "import xgboost as xgb \n",
    "import copy \n",
    "\n",
    "from sklearn.ensemble import IsolationForest\n",
    "\n",
    "import matplotlib.pyplot as plt \n",
    "from matplotlib import rcParams\n",
    "rcParams[\"font.family\"] = \"SimHei\"\n",
    "\n",
    "import seaborn as sns\n",
    "\n",
    "from itertools import combinations \n",
    "import pickle\n",
    "# from bayes_opt import BayesianOptimization\n",
    "# import optuna\n",
    "from functools import partial\n",
    "\n",
    "import networkx as nx \n",
    "from itertools import combinations\n",
    "from functools import partial\n",
    "from sklearn.metrics import roc_auc_score\n",
    "from sklearn.preprocessing import LabelEncoder\n",
    "from sklearn.preprocessing import OneHotEncoder\n",
    "from sklearn.preprocessing import MinMaxScaler,StandardScaler\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "from sklearn.linear_model import LogisticRegressionCV\n",
    "from sklearn.metrics import confusion_matrix,accuracy_score,classification_report,roc_auc_score,log_loss\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "import sklearn.metrics as metrics\n",
    "from sklearn.metrics import classification_report\n",
    "from sklearn.metrics import roc_curve\n",
    "from sklearn.model_selection import KFold\n",
    "from sklearn.feature_selection import RFECV\n",
    "from sklearn.model_selection import StratifiedKFold\n",
    "import sklearn.ensemble as ensemble\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.model_selection import cross_val_score\n",
    "from sklearn import svm\n",
    "from sklearn.feature_selection import SelectFromModel\n",
    "\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.ensemble import GradientBoostingClassifier\n",
    "from sklearn.metrics import f1_score\n",
    "\n",
    "import xgboost as xgb\n",
    "from xgboost import XGBClassifier\n",
    "\n",
    "# import lightgbm as lgb\n",
    "# from lightgbm import LGBMClassifier\n",
    "# from lightgbm import log_evaluation, early_stopping\n",
    "\n",
    "import catboost as cbt\n",
    "from catboost import CatBoostClassifier\n",
    "\n",
    "from scipy import stats,integrate\n",
    "from scipy.stats import ks_2samp\n",
    "#from scipy.stats import kssamp\n",
    "from scipy.stats import pearsonr\n",
    "from sklearn.model_selection import RandomizedSearchCV\n",
    "from scipy.stats import uniform\n",
    "from scipy.stats import kstest\n",
    "\n",
    "import toad\n",
    "\n",
    "pd.set_option('display.max_columns', 50)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c0f923bd-1bec-46b2-8824-62214d871543",
   "metadata": {},
   "source": [
    "# 工具函数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aec48db7-13b0-42ab-bc57-4b98a0db7741",
   "metadata": {},
   "source": [
    "## 读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e3b8f266-593c-413e-8267-9960e7d5eb96",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:20.710273Z",
     "iopub.status.busy": "2024-11-11T00:59:20.709397Z",
     "iopub.status.idle": "2024-11-11T00:59:20.721109Z",
     "msg_id": "9ec6b586-0a06-47e3-8e34-aa9b54e349aa",
     "shell.execute_reply": "2024-11-11T00:59:20.720272Z",
     "shell.execute_reply.started": "2024-11-11T00:59:20.710239Z"
    }
   },
   "outputs": [],
   "source": [
    "def get_data(file_name, num_rows=None):\n",
    "    train_path = \"/home/mole/work/contest/train\"\n",
    "    test_path = \"/home/mole/work/contest/A\"\n",
    "    df_train = pd.read_csv(os.path.join(train_path, file_name + \"_T.csv\"), nrows=num_rows)\n",
    "    df_test = pd.read_csv(os.path.join(test_path, file_name + \"_A.csv\"), nrows=num_rows)\n",
    "    df_train[\"is_train\"] = 1\n",
    "    df_test[\"is_train\"] = 0\n",
    "    \n",
    "    df = pd.concat(objs=[df_train, df_test],axis=0)\n",
    "    df.rename(mapper = {'DATA_DAT': '数据日期', 'CUST_NO': '客户编号', 'OPTO': '经营期限至', 'OPFROM': '经营期限自', 'ENTSTATUS': '经营状态', 'REGCAP': '注册资本', 'ESDATE': '成立日期', 'FRNAME': '法定代表人/负责人/执行事务合伙人', 'ENTTYPE_CD': '企业（机构）类型编码', 'REGPROVIN_CD': '所在省份编码', 'INDS_CD': '国民经济行业代码', 'ALTDATE': '变更日期', 'ALTITEM': '变更事项', 'PERNAME': '人员姓名', 'POSITIONCODE': '职位代码', 'PERSONAMOUNT': '人员总数量', 'WEBTYPE': '网站（网店）类型', 'WEBSITNAME': '网站（网店）名称', 'DOMAIN': '网站（网店）地址', 'ANCHEDATE': '年报日期', 'ANCHEYEAR': '年报年份', 'EXECMONEY': '执行标的', 'REGDATECLEAN': '立案时间', 'COURTNAME': '执行法院', 'CASECODE': '案号', 'PUBLISHDATECLEAN': '发布时间', 'GISTID': '执行依据文号', 'PERFORMANCE': '被执行人履行情况', 'REGDATE': '立案时间', 'FINALDATE': '终本日期', 'UNPERFMONEY': '未履行金额', 'CONDATE': '出资日期', 'SUBCONAM': '认缴出资额（万元）', 'FUNDEDRATIO': '出资比例', 'INVTYPE': '股东类型', 'CONFORM': '出资方式', 'SH_CUST_NO': '股东客户编号', 'BTD_BEGINDATE': '所属日期起', 'BTD_ENDDATE': '所属日期止', 'BTD_COLLECTCODE': '征收项目代码', 'BTD_DECLARDATE': '申报日期', 'BTD_DECLARTERM': '申报期限', 'BTD_TOTALSALE': '全部销售收入', 'BTD_TAXABLESALE': '应税销售收入', 'BTD_TAXPAYABLE': '应纳税额', 'BTD_DEDUCTAMOUNT': '减免税额', 'TR_DAT': '交易日期', 'TR_CD': '交易代码', 'CHANL_CD': '渠道代码', 'ABS_INFO': '摘要信息', 'CPT_TYP_CD': '交易对手类型代码', 'ARG_ACCT_BAL': '合约账户余额', 'ACTG_DIRET_CD': '记账方向代码', 'TRS_CSH_IND': '现转标识', 'CSH_EX_IND': '钞汇标识', 'RMB_TR_AMT': '折人民币交易金额', 'CPT_INTL_FE_CUST_IND': '对手方行内客户标识', 'INT_BNK_TR_IND': '是否跨行交易', 'SAME_NAM_IND': '同名账户标识', 'CPT_CUST_NO': '交易对手客户编号'},\n",
    "              axis=1,\n",
    "              inplace=True\n",
    "             )\n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b92cbe60-099a-4da6-b9cd-4e6cf7e7fb2d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:21.732138Z",
     "iopub.status.busy": "2024-11-11T00:59:21.731676Z",
     "iopub.status.idle": "2024-11-11T00:59:21.738549Z",
     "msg_id": "365d34f7-9436-452f-bcdf-2e8d6a95ac9e",
     "shell.execute_reply": "2024-11-11T00:59:21.737725Z",
     "shell.execute_reply.started": "2024-11-11T00:59:21.732108Z"
    }
   },
   "outputs": [],
   "source": [
    "def agg_statistics(df, group_cols, agg_functions, name_flag, p=False):\n",
    "    \"\"\"\n",
    "    分组聚合。\n",
    "    \"\"\"\n",
    "    ga = df.groupby(by=group_cols).agg(agg_functions)\n",
    "    ga.columns = [\"{}_{}_{}\".format(e[0], e[1], name_flag) for e in ga.columns.tolist()]\n",
    "    ga.reset_index(inplace=True)\n",
    "    \n",
    "    new_cols = [col for col in ga.columns.tolist() if col not in group_cols]\n",
    "    if p is True:\n",
    "        print(\"新聚合特征：\\n\", new_cols)\n",
    "    \n",
    "    return ga, new_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d970bd24-4399-446d-9b97-fd9b5f9db18d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:23.484344Z",
     "iopub.status.busy": "2024-11-11T00:59:23.483892Z",
     "iopub.status.idle": "2024-11-11T00:59:23.493124Z",
     "msg_id": "772e3322-34e7-408d-bfec-fb914395bdbd",
     "shell.execute_reply": "2024-11-11T00:59:23.492237Z",
     "shell.execute_reply.started": "2024-11-11T00:59:23.484314Z"
    }
   },
   "outputs": [],
   "source": [
    "# 趋势差分特征衍生\n",
    "def get_kurt(series_x):\n",
    "    kurt = series_x.kurt()\n",
    "    return kurt\n",
    "    \n",
    "def trend_indicator(df, group_dim_1, group_dim_2, agg_functions, name_flag, offset=-1):\n",
    "    \"\"\"\n",
    "    group_dim_1：第一维度\n",
    "    group_dim_2：第二维度\n",
    "    \"\"\"\n",
    "    df = df.sort_values(by=group_dim_2, ascending=True)\n",
    "    ga = df.groupby(by=[group_dim_1, group_dim_2]).agg(agg_functions)\n",
    "    ga.columns = [\"{}_{}_{}\".format(e[0], name_flag, e[1]) for e in ga.columns.tolist()]\n",
    "    new_features = ga.columns.tolist()\n",
    "    ga.reset_index(inplace=True)\n",
    "\n",
    "    diff_new_features = []\n",
    "    for fea in new_features:\n",
    "        t = \"一阶差分_{}_{}\".format(fea, offset)\n",
    "        diff_new_features.append(t)\n",
    "        ga[t] = ga.groupby(by=group_dim_1)[fea].diff(offset) # -1\n",
    "\n",
    "    all_new_features = new_features + diff_new_features\n",
    "    agg_functions_tmp = {}\n",
    "    for fea in all_new_features:\n",
    "        agg_functions_tmp.update({fea:['last','mean','skew',get_kurt,'std','sum','max','min']})    \n",
    "\n",
    "    ga_new, _ = agg_statistics(df=ga, group_cols=[group_dim_1], agg_functions=agg_functions_tmp, name_flag=\"差分特征_{}\".format(name_flag))\n",
    "\n",
    "    return ga_new"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cb2e163e-f4fc-45f3-a2c4-0d2aede47a94",
   "metadata": {},
   "source": [
    "# 模型训练"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "0a98d14f-2ba9-4fdb-8843-a285ea282c94",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:27.039808Z",
     "iopub.status.busy": "2024-11-11T00:59:27.039254Z",
     "iopub.status.idle": "2024-11-11T00:59:27.054579Z",
     "msg_id": "4d1a7290-86f3-45b1-af8e-28db823f0942",
     "shell.execute_reply": "2024-11-11T00:59:27.053727Z",
     "shell.execute_reply.started": "2024-11-11T00:59:27.039777Z"
    }
   },
   "outputs": [],
   "source": [
    "def LGB_model(\n",
    "              X=None,\n",
    "              y=None,\n",
    "              params=None,\n",
    "              num_boost_round=10000,\n",
    "              categorical_feature=None,\n",
    "              cv=StratifiedKFold(n_splits=5, shuffle=True, random_state=2022)\n",
    "             ):\n",
    "\n",
    "    callbacks = [log_evaluation(period=100), early_stopping(stopping_rounds = 200)]\n",
    "    if params is None:\n",
    "        params = {\n",
    "                    \"boost\":\"gbdt\",\n",
    "                    \"objective\":\"binary\",\n",
    "                    \"metric\":\"auc\",\n",
    "                    \"max_depth\":6,\n",
    "                    \"learning_rate\":0.05,\n",
    "                    \"feature_fraction\":0.85,\n",
    "                    \"bagging_fraction\":0.85,\n",
    "                    \"bagging_freq\":5,\n",
    "                    \"max_bin\":56,\n",
    "                    \"seed\":2022,    # 随机数种子，必须设置\n",
    "                    \"verbose\":-1\n",
    "                }\n",
    "\n",
    "    columns = X.columns.tolist() \n",
    "\n",
    "    y_oof = np.zeros(X.shape[0])\n",
    "    score = 0\n",
    "    score_auc = 0\n",
    "    clfs = []\n",
    "    ks_list = []\n",
    "    for k, (trian_index, valid_index) in enumerate(cv.split(X, y)):\n",
    "\n",
    "        X_train, y_train = X.values[trian_index], y.values[trian_index]\n",
    "        X_valid, y_valid = X.values[valid_index], y.values[valid_index]\n",
    "        train_D = lgb.Dataset(data=X_train, label=y_train, feature_name=columns, categorical_feature=categorical_feature)\n",
    "        valid_D = lgb.Dataset(data=X_valid, label=y_valid, feature_name=columns, categorical_feature=categorical_feature, reference=train_D)\n",
    "\n",
    "        clf = lgb.train(params=params,\n",
    "                        train_set=train_D,\n",
    "                        valid_sets=[train_D, valid_D],\n",
    "                        valid_names=[\"Train\", \"Valid\"],\n",
    "                        num_boost_round=num_boost_round,\n",
    "                        callbacks = callbacks\n",
    "                        )\n",
    "        y_pred_valid = clf.predict(X_valid, num_iteration=clf.best_iteration)\n",
    "        y_oof[valid_index] = y_pred_valid\n",
    "        print(\"=======================================\")\n",
    "        print(\"第 {} 折，当前 KS = {:.6}\".format(k+1, get_KS(y_valid, y_pred_valid)))\n",
    "        print(\"=======================================\")\n",
    "        score = score + get_KS(y_valid, y_pred_valid)\n",
    "        score_auc = score_auc + roc_auc_score(y_valid, y_pred_valid)\n",
    "        ks_list.append(get_KS(y_valid, y_pred_valid))\n",
    "\n",
    "        # 测算最佳阈值\n",
    "\n",
    "        del X_train, X_valid, y_train, y_valid\n",
    "        gc.collect()\n",
    "\n",
    "        clfs.append(clf)\n",
    "\n",
    "    ks_list.append(score/(k+1))\n",
    "    ks_list.append(get_KS(y, y_oof))\n",
    "    print(\"平均 KS = {:.6}\".format(score/(k+1)))\n",
    "    print(\"Out of folds KS = {:.6}\".format(get_KS(y, y_oof)))\n",
    "\n",
    "    print(\"平均 AUC = {:.6}\".format(score_auc/(k+1)))\n",
    "    auc = roc_auc_score(y, y_oof)\n",
    "    print(\"Out of folds AUC = {:.6}\".format(auc))\n",
    "\n",
    "    return clfs, ks_list, get_KS(y, y_oof)\n",
    "\n",
    "## 计算KS\n",
    "def get_KS(y_true, y_pred):\n",
    "    fpr, tpr, _ = roc_curve(y_true, y_pred)\n",
    "    return max(abs((fpr-tpr)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "003e0989-5f64-42b8-a60b-a322e6aa8035",
   "metadata": {},
   "source": [
    "## 特征重要性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "4d93c8ff-cddb-4e50-8764-814ddb6c88db",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:29.009310Z",
     "iopub.status.busy": "2024-11-11T00:59:29.008837Z",
     "iopub.status.idle": "2024-11-11T00:59:29.016538Z",
     "msg_id": "ae1ce18b-f02f-496b-b3b2-9882076a587f",
     "shell.execute_reply": "2024-11-11T00:59:29.015694Z",
     "shell.execute_reply.started": "2024-11-11T00:59:29.009278Z"
    }
   },
   "outputs": [],
   "source": [
    "def get_feature_imp(clfs, imp_type='gain', feature_names=None, top_n=25):\n",
    "    \"\"\"\n",
    "    获取模型训练时的特征重要性，并绘图。\n",
    "    \"\"\"\n",
    "    feature_importances = pd.DataFrame()\n",
    "    feature_importances['feature'] = feature_names\n",
    "    for i, clf in enumerate(clfs):\n",
    "        feature_importances[str(i)] = clf.feature_importance(imp_type)\n",
    "    feature_importances['average'] = np.exp(np.log1p(feature_importances[[str(i) for i in range(len(clfs))]]).mean(axis=1))\n",
    "    \n",
    "    plt.figure(figsize=(20, 16))\n",
    "    sns.barplot(data=feature_importances.sort_values(by='average', ascending=False).head(top_n), x='average', y='feature');\n",
    "    plt.title('{} TOP feature importance over {} folds average gain'.format(top_n, 5));\n",
    "    return feature_importances.sort_values(by='average', ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5b765a82-eb46-424c-9c43-bec755069d11",
   "metadata": {},
   "source": [
    "# 标签信息表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a3adb0a3-62d0-4672-9adc-fb30c177408b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:31.020851Z",
     "iopub.status.busy": "2024-11-11T00:59:31.020392Z",
     "iopub.status.idle": "2024-11-11T00:59:31.094930Z",
     "msg_id": "a4a36bcc-ff16-4f34-9b36-50f182ae3517",
     "shell.execute_reply": "2024-11-11T00:59:31.094110Z",
     "shell.execute_reply.started": "2024-11-11T00:59:31.020820Z"
    }
   },
   "outputs": [],
   "source": [
    "TARGET = get_data(\"XW_ENTINFO_TARGET\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "706639ed-196a-4608-bca9-b1053c5dc23b",
   "metadata": {},
   "source": [
    "# 企业基本信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "cb7a1342-fe8c-45d2-9938-f4a97bbeb8c8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:32.980056Z",
     "iopub.status.busy": "2024-11-11T00:59:32.979591Z",
     "iopub.status.idle": "2024-11-11T00:59:33.329451Z",
     "msg_id": "b74c0a15-109c-40c2-8ab4-bdc57085b084",
     "shell.execute_reply": "2024-11-11T00:59:33.328594Z",
     "shell.execute_reply.started": "2024-11-11T00:59:32.980026Z"
    }
   },
   "outputs": [],
   "source": [
    "BASIC = get_data(\"XW_ENTINFO_BASIC\").merge(TARGET[[\"客户编号\",\"FLAG\"]], how=\"left\", on=\"客户编号\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "25b7f9c3-3e66-41f2-a206-9a693328dc6f",
   "metadata": {},
   "source": [
    "# 企业金融性交易明细"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e9cd04dd-0021-452b-a9c2-492a519b4c07",
   "metadata": {},
   "source": [
    "## 第二版差分特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d1aad856-fda5-42e1-8c48-3d1d9a3c8c13",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "063ef3f6-d28c-45c0-83c8-5edb5da580d4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-10T15:22:25.712149Z",
     "iopub.status.busy": "2024-11-10T15:22:25.711418Z",
     "iopub.status.idle": "2024-11-10T15:22:25.734700Z",
     "msg_id": "24f4de9c-c9c0-4ae5-85f4-a9b15bfa2863",
     "shell.execute_reply": "2024-11-10T15:22:25.733773Z",
     "shell.execute_reply.started": "2024-11-10T15:22:25.712116Z"
    }
   },
   "outputs": [],
   "source": [
    "def 交易流水_第二版差分特征():\n",
    "    \"\"\"\n",
    "    按月份统计差分,覆盖交易对手类型、记账方向代码、交易代码（常见少见）\n",
    "    \"\"\"\n",
    "    data = get_data(\"XW_ENTINFO_FNCL_TR_DTAL\").merge(TARGET[[\"客户编号\",\"FLAG\"]], how=\"left\", on=\"客户编号\")\n",
    "    \n",
    "    data[\"交易年月\"] = data[\"交易日期\"].apply(lambda x:str(x)[:6])\n",
    "    data[\"交易年月\"] = data[\"交易年月\"].map({\"200208\":1,\"200207\":2,\"200206\":3,\"200205\":4,\"200204\":5})\n",
    "    \n",
    "    agg_functions_diff =  {\n",
    "        \"合约账户余额\":[\"sum\",\"mean\",\"count\"],\n",
    "        \"折人民币交易金额\":[\"sum\",\"mean\"],\n",
    "    }\n",
    "    \n",
    "    # 全部数据差分\n",
    "    全部流水_diff = trend_indicator(df=data,\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    # 对公个人客户交易流水差分\n",
    "    data[\"交易对手类型代码\"] = data[\"交易对手类型代码\"].map({\"89e3310a438292017fbbb0f2f799f948\":\"对公\", \"95d423a88e97fd7197c280e86489cef5\":\"个人\"})\n",
    "    对公流水_diff = trend_indicator(df=data[data[\"交易对手类型代码\"] == \"对公\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_对公_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    个人流水_diff = trend_indicator(df=data[data[\"交易对手类型代码\"] == \"个人\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_个人_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    # 转入转出流水差分\n",
    "    data[\"记账方向代码\"] = data[\"记账方向代码\"].map({\"16459755d990723240edb88e34a13fab\":\"转出\", \"1250d7cb654a81c7b9366dabf57fe62b\":\"转入\"})\n",
    "    转出流水_diff = trend_indicator(df=data[data[\"记账方向代码\"] == \"转出\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_转出_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    转入流水_diff = trend_indicator(df=data[data[\"记账方向代码\"] == \"转入\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_转入_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    # 常见少见交易流水差分\n",
    "    tail_ind = data[\"交易代码\"].value_counts(normalize=True)[data[\"交易代码\"].value_counts(normalize=True) < 0.01].index.tolist()\n",
    "    data[\"是否为少见交易类型\"] = data[\"交易代码\"].apply(lambda x: 1 if x in tail_ind else 0)\n",
    "    \n",
    "    常见交易流水_diff = trend_indicator(df=data[data[\"是否为少见交易类型\"] == 0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_常见交易_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    少见交易流水_diff = trend_indicator(df=data[data[\"是否为少见交易类型\"] == 1],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_少见交易_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    \n",
    "    # 对手方行内客户流水差分\n",
    "    对手0流水_diff = trend_indicator(df=data[data[\"对手方行内客户标识\"] == 0.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_对手方行内0_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    对手1流水_diff = trend_indicator(df=data[data[\"对手方行内客户标识\"] == 1.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_对手方行内1_按月流水\"\n",
    "                           )\n",
    "    \n",
    "    # 是否跨行交易流水差分\n",
    "    跨行0流水_diff = trend_indicator(df=data[data[\"是否跨行交易\"] == 0.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_跨行0.0_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    跨行1流水_diff = trend_indicator(df=data[data[\"是否跨行交易\"] == 1.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_跨行1.0_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    # 是否同名账户流水差分\n",
    "    同名0流水_diff = trend_indicator(df=data[data[\"同名账户标识\"] == 0.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_同名0.0_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    同名1流水_diff = trend_indicator(df=data[data[\"同名账户标识\"] == 1.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"交易年月\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_同名1.0_按月流水\"\n",
    "                               )\n",
    "    \n",
    "    fea_二次差分 = 全部流水_diff.merge(对公流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(个人流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(转出流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(转入流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(常见交易流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(少见交易流水_diff, how=\"left\",on=\"客户编号\")\n",
    "\n",
    "    fea_二次差分 = fea_二次差分.merge(对手0流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(对手1流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(跨行0流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(跨行1流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(同名0流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_二次差分 = fea_二次差分.merge(同名1流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    \n",
    "    return fea_二次差分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "09c5733d-eba1-4de0-ad9d-bea01c4ee2b8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-10T15:22:30.415205Z",
     "iopub.status.busy": "2024-11-10T15:22:30.414718Z",
     "iopub.status.idle": "2024-11-10T15:38:07.921761Z",
     "msg_id": "6b1bb6a6-5d85-45d2-b234-7556616b4ef5",
     "shell.execute_reply": "2024-11-10T15:38:07.920913Z",
     "shell.execute_reply.started": "2024-11-10T15:22:30.415172Z"
    }
   },
   "outputs": [],
   "source": [
    "# 注意，该函数执行时，pandas版本必须升至2.2.2版本\n",
    "fea_二次差分 = 交易流水_第二版差分特征()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "bf814316-dbc2-4b9f-8ddf-848cc511244d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:42:59.729595Z",
     "iopub.status.busy": "2024-11-11T00:42:59.729103Z",
     "iopub.status.idle": "2024-11-11T00:43:00.525735Z",
     "msg_id": "c156ef15-8002-4217-8ad4-b680dadd7a1a",
     "shell.execute_reply": "2024-11-11T00:43:00.524952Z",
     "shell.execute_reply.started": "2024-11-11T00:42:59.729562Z"
    }
   },
   "outputs": [],
   "source": [
    "fea_二次差分.to_pickle(\"../data/数据还原_金融性交易明细_第二版差分特征_v2_1111_pandas2.2.2.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "e3ba20e4-3986-4ef5-9dc9-479e7434ad14",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:20:20.478968Z",
     "iopub.status.busy": "2024-11-11T00:20:20.478464Z",
     "iopub.status.idle": "2024-11-11T00:20:20.861933Z",
     "msg_id": "78795dfe-7f4f-45f6-8cf0-2a37b033dfc1",
     "shell.execute_reply": "2024-11-11T00:20:20.861120Z",
     "shell.execute_reply.started": "2024-11-11T00:20:20.478935Z"
    }
   },
   "outputs": [],
   "source": [
    "o_df_二次差分 = pd.read_pickle(\"/home/mole/work/xukunzhou/20241030/data/金融性交易明细_第二版差分特征_v2_1030.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "d0036757-b1f7-49dd-ba5b-22069f926d02",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:20:23.535751Z",
     "iopub.status.busy": "2024-11-11T00:20:23.535263Z",
     "iopub.status.idle": "2024-11-11T00:20:23.954744Z",
     "msg_id": "460903c2-dbde-4c3c-b561-e453a5b46981",
     "shell.execute_reply": "2024-11-11T00:20:23.954053Z",
     "shell.execute_reply.started": "2024-11-11T00:20:23.535718Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fea_二次差分.equals(o_df_二次差分)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "f1fb2367-355b-432d-9c3a-95989cb651a1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T03:35:52.853928Z",
     "iopub.status.busy": "2024-10-30T03:35:52.853448Z",
     "iopub.status.idle": "2024-10-30T03:35:53.644701Z",
     "msg_id": "88c7a793-6ca4-4588-b280-bedc24feb4ee",
     "shell.execute_reply": "2024-10-30T03:35:53.643912Z",
     "shell.execute_reply.started": "2024-10-30T03:35:52.853895Z"
    }
   },
   "outputs": [],
   "source": [
    "# fea_二次差分.to_pickle(\"/home/mole/work/xukunzhou/20241030/data/金融性交易明细_第二版差分特征_v2_1030.pkl\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b95c6f3c-6a42-4390-856b-bec272b075d5",
   "metadata": {},
   "source": [
    "## 合约账户余额新版特征：按周差分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "3a4d91a2-7f1c-469a-9148-494b902f7d06",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:21:01.590636Z",
     "iopub.status.busy": "2024-11-11T00:21:01.589896Z",
     "iopub.status.idle": "2024-11-11T00:21:01.612929Z",
     "msg_id": "744a07b5-9fca-4670-b773-3131078fa416",
     "shell.execute_reply": "2024-11-11T00:21:01.612096Z",
     "shell.execute_reply.started": "2024-11-11T00:21:01.590601Z"
    }
   },
   "outputs": [],
   "source": [
    "def 交易流水_第三版差分特征():\n",
    "    \"\"\"\n",
    "    与第二版的差别在与按7天进行差分\n",
    "    \"\"\"\n",
    "    data = get_data(\"XW_ENTINFO_FNCL_TR_DTAL\").merge(TARGET[[\"客户编号\",\"FLAG\"]], how=\"left\", on=\"客户编号\")\n",
    "    # 匹配企业成立日期\n",
    "    data = data.merge(BASIC[[\"客户编号\",\"成立日期\",\"数据日期\"]], how=\"left\", on=\"客户编号\")\n",
    "    \n",
    "    data.rename(mapper={\"数据日期\":\"采样日期\"}, inplace=True,axis=1)\n",
    "    \n",
    "    data[\"交易日期\"] = data[\"交易日期\"].astype(\"str\").astype(\"datetime64[ns]\")\n",
    "    data[\"采样日期\"] = data[\"采样日期\"].astype(\"str\").astype(\"datetime64[ns]\")\n",
    "    data[\"采样日期_距离_交易日期_天数\"] = (data[\"采样日期\"] - data[\"交易日期\"]).dt.days \n",
    "    \n",
    "    data[\"采样日期_距离_交易日期_7天\"] = data[\"采样日期_距离_交易日期_天数\"] // 7 + 1 \n",
    "    \n",
    "    agg_functions_diff =  {\n",
    "        \"合约账户余额\":[\"sum\",\"mean\",\"count\"],\n",
    "        \"折人民币交易金额\":[\"sum\",\"mean\"],\n",
    "    }\n",
    "    \n",
    "    # 全部数据差分\n",
    "    全部流水_diff = trend_indicator(df=data,\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    # 对公个人客户交易流水差分\n",
    "    data[\"交易对手类型代码\"] = data[\"交易对手类型代码\"].map({\"89e3310a438292017fbbb0f2f799f948\":\"对公\", \"95d423a88e97fd7197c280e86489cef5\":\"个人\"})\n",
    "    对公流水_diff = trend_indicator(df=data[data[\"交易对手类型代码\"] == \"对公\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_对公_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    个人流水_diff = trend_indicator(df=data[data[\"交易对手类型代码\"] == \"个人\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_个人_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    # 转入转出流水差分\n",
    "    data[\"记账方向代码\"] = data[\"记账方向代码\"].map({\"16459755d990723240edb88e34a13fab\":\"转出\", \"1250d7cb654a81c7b9366dabf57fe62b\":\"转入\"})\n",
    "    转出流水_diff = trend_indicator(df=data[data[\"记账方向代码\"] == \"转出\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_转出_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    转入流水_diff = trend_indicator(df=data[data[\"记账方向代码\"] == \"转入\"],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_转入_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    # 常见少见交易流水差分\n",
    "    tail_ind = data[\"交易代码\"].value_counts(normalize=True)[data[\"交易代码\"].value_counts(normalize=True) < 0.01].index.tolist()\n",
    "    data[\"是否为少见交易类型\"] = data[\"交易代码\"].apply(lambda x: 1 if x in tail_ind else 0)\n",
    "    \n",
    "    常见交易流水_diff = trend_indicator(df=data[data[\"是否为少见交易类型\"] == 0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_常见交易_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    少见交易流水_diff = trend_indicator(df=data[data[\"是否为少见交易类型\"] == 1],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_少见交易_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    # 是否跨行交易流水差分\n",
    "    跨行0流水_diff = trend_indicator(df=data[data[\"是否跨行交易\"] == 0.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_跨行0.0_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    跨行1流水_diff = trend_indicator(df=data[data[\"是否跨行交易\"] == 1.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_跨行1.0_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    # 是否同名账户流水差分\n",
    "    同名0流水_diff = trend_indicator(df=data[data[\"同名账户标识\"] == 0.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_同名0.0_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    同名1流水_diff = trend_indicator(df=data[data[\"同名账户标识\"] == 1.0],\n",
    "                               group_dim_1=\"客户编号\",\n",
    "                               group_dim_2=\"采样日期_距离_交易日期_7天\",\n",
    "                               agg_functions=agg_functions_diff, \n",
    "                               name_flag=\"金融性交易_同名1.0_按7天流水\"\n",
    "                               )\n",
    "    \n",
    "    fea_三次差分 = 全部流水_diff.merge(对公流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(个人流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(转出流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(转入流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(常见交易流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(少见交易流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    \n",
    "    fea_三次差分 = fea_三次差分.merge(跨行0流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(跨行1流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(同名0流水_diff, how=\"left\",on=\"客户编号\")\n",
    "    fea_三次差分 = fea_三次差分.merge(同名1流水_diff, how=\"left\",on=\"客户编号\")\n",
    "\n",
    "    return fea_三次差分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "e8e1baa3-ca55-4b09-83f8-0d323a61dc52",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:21:18.834678Z",
     "iopub.status.busy": "2024-11-11T00:21:18.834122Z",
     "iopub.status.idle": "2024-11-11T00:36:04.377977Z",
     "msg_id": "701e1313-df79-49ab-a5fd-44b091aefb63",
     "shell.execute_reply": "2024-11-11T00:36:04.377164Z",
     "shell.execute_reply.started": "2024-11-11T00:21:18.834642Z"
    }
   },
   "outputs": [],
   "source": [
    "# 注意，该函数执行时，pandas版本必须升至2.2.2版本\n",
    "fea_三次差分 = 交易流水_第三版差分特征()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "70f4893a-f249-4d6a-bccd-04b616046438",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:39:56.794829Z",
     "iopub.status.busy": "2024-11-11T00:39:56.794335Z",
     "iopub.status.idle": "2024-11-11T00:39:57.501810Z",
     "msg_id": "5a0d4844-71f1-4c53-bb86-b7fc957bfb80",
     "shell.execute_reply": "2024-11-11T00:39:57.500955Z",
     "shell.execute_reply.started": "2024-11-11T00:39:56.794796Z"
    }
   },
   "outputs": [],
   "source": [
    "fea_三次差分.to_pickle(\"../data/数据还原_金融性交易明细_第三版差分特征_1111_pandas2.2.2.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "982ae3af-727e-4faf-b132-52c08263139c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:37:46.627575Z",
     "iopub.status.busy": "2024-11-11T00:37:46.627092Z",
     "iopub.status.idle": "2024-11-11T00:37:46.952336Z",
     "msg_id": "f4ce0a9d-105b-4218-821a-22f8744aa256",
     "shell.execute_reply": "2024-11-11T00:37:46.951608Z",
     "shell.execute_reply.started": "2024-11-11T00:37:46.627543Z"
    }
   },
   "outputs": [],
   "source": [
    "o_df_三次差分 = pd.read_pickle(\"/home/mole/work/xukunzhou/20241030/data/金融性交易明细_第三版差分特征_1030.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "8bfa8200-a08c-493d-be58-879bff35061f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:38:03.943564Z",
     "iopub.status.busy": "2024-11-11T00:38:03.943070Z",
     "iopub.status.idle": "2024-11-11T00:38:04.303548Z",
     "msg_id": "e7ce9859-3a97-4ead-87a4-7e53dfe8419b",
     "shell.execute_reply": "2024-11-11T00:38:04.302769Z",
     "shell.execute_reply.started": "2024-11-11T00:38:03.943532Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fea_三次差分.equals(o_df_三次差分)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "33685231-f71d-4155-b92d-52a812f125e1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T04:34:10.225838Z",
     "iopub.status.busy": "2024-10-30T04:34:10.225311Z",
     "iopub.status.idle": "2024-10-30T04:34:10.934489Z",
     "msg_id": "956ae72c-4bbc-4f99-aa8a-8fb5cfcd482b",
     "shell.execute_reply": "2024-10-30T04:34:10.933663Z",
     "shell.execute_reply.started": "2024-10-30T04:34:10.225807Z"
    }
   },
   "outputs": [],
   "source": [
    "# fea_三次差分.to_pickle(\"/home/mole/work/xukunzhou/20241030/data/金融性交易明细_第三版差分特征_1030.pkl\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1b591e73-bb0f-4dfa-b719-7406649d8041",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-10-30T04:37:31.697777Z",
     "iopub.status.busy": "2024-10-30T04:37:31.697245Z",
     "iopub.status.idle": "2024-10-30T04:37:31.701353Z",
     "msg_id": "73cbfe63-a197-43d9-9a5e-f0fa9afc52e8",
     "shell.execute_reply": "2024-10-30T04:37:31.700661Z",
     "shell.execute_reply.started": "2024-10-30T04:37:31.697746Z"
    }
   },
   "source": [
    "## 汇总四个版本差分特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a7827e20-d901-4a81-820a-24ac7b6297f0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-12T07:25:31.321549Z",
     "iopub.status.busy": "2024-11-12T07:25:31.321050Z",
     "iopub.status.idle": "2024-11-12T07:25:32.638425Z",
     "msg_id": "e5d19dbc-3e8a-4b36-a1a4-742716ebe586",
     "shell.execute_reply": "2024-11-12T07:25:32.637679Z",
     "shell.execute_reply.started": "2024-11-12T07:25:31.321513Z"
    }
   },
   "outputs": [],
   "source": [
    "df_1 = pd.read_pickle(\"../data/数据还原_企业金融性交易明细_差分特征.pkl\")\n",
    "df_2 = pd.read_pickle(\"../data/数据还原_企业金融性交易流水_简单逻辑特征_1107.pkl\")\n",
    "df_3 = pd.read_pickle(\"../data/数据还原_金融性交易明细_第二版差分特征_v2_1111_pandas2.2.2.pkl\")\n",
    "df_4 = pd.read_pickle(\"../data/数据还原_金融性交易明细_第三版差分特征_1111_pandas2.2.2.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "07a24f47-24e9-4f02-b33c-b574f007ea00",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:59:52.965921Z",
     "iopub.status.busy": "2024-11-11T00:59:52.965517Z",
     "iopub.status.idle": "2024-11-11T01:00:01.874352Z",
     "msg_id": "964d4a08-a831-4d06-a942-b67a276a0685",
     "shell.execute_reply": "2024-11-11T01:00:01.873446Z",
     "shell.execute_reply.started": "2024-11-11T00:59:52.965888Z"
    }
   },
   "outputs": [],
   "source": [
    "df = df_1.merge(df_2, how=\"left\", on=\"客户编号\")\n",
    "df = df.merge(df_3, how=\"left\", on=\"客户编号\")\n",
    "df = df.merge(df_4, how=\"left\", on=\"客户编号\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1133bf4a-0f97-4a2f-bbb1-acf2edd96b4f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T01:00:03.352148Z",
     "iopub.status.busy": "2024-11-11T01:00:03.351677Z",
     "iopub.status.idle": "2024-11-11T01:00:05.467566Z",
     "msg_id": "8d774816-db72-4fc6-8c2f-742e2b72e591",
     "shell.execute_reply": "2024-11-11T01:00:05.466669Z",
     "shell.execute_reply.started": "2024-11-11T01:00:03.352117Z"
    }
   },
   "outputs": [],
   "source": [
    "df = df.merge(TARGET[[\"客户编号\", \"FLAG\"]], how=\"left\", on=\"客户编号\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "54b4c2ef-1e82-474b-9e3e-ac64daadbc91",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T00:53:23.761584Z",
     "iopub.status.busy": "2024-11-11T00:53:23.761147Z",
     "iopub.status.idle": "2024-11-11T00:53:23.766464Z",
     "msg_id": "318addeb-3e64-49cc-bce4-9b46efbdeb22",
     "shell.execute_reply": "2024-11-11T00:53:23.765835Z",
     "shell.execute_reply.started": "2024-11-11T00:53:23.761556Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(59066, 3294)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "0ea034c7-9854-4d26-ac9b-e519cbda6a09",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T01:10:59.545476Z",
     "iopub.status.busy": "2024-11-11T01:10:59.544858Z",
     "iopub.status.idle": "2024-11-11T01:11:00.013317Z",
     "msg_id": "2a1cbcdc-173b-4cb5-8000-487059f6d92c",
     "shell.execute_reply": "2024-11-11T01:11:00.012397Z",
     "shell.execute_reply.started": "2024-11-11T01:10:59.545443Z"
    }
   },
   "outputs": [],
   "source": [
    "feas_keep_462 = ['合约账户余额_金融性交易_跨行0.0_按7天流水_mean_mean_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_跨行0.0_按7天流水_mean_min_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_对公_按7天流水_sum_min_差分特征_金融性交易_对公_按7天流水', '合约账户余额_金融性交易_对手方行内0_按月流水_mean_min_差分特征_金融性交易_对手方行内0_按月流水', '一阶差分_折人民币交易金额_金融性交易_对公_按7天流水_mean_-1_std_差分特征_金融性交易_对公_按7天流水', '合约账户余额_金融性交易_跨行0.0_按7天流水_sum_min_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_同名1.0_按7天流水_mean_min_差分特征_金融性交易_同名1.0_按7天流水', '合约账户余额_金融性交易_同名0.0_按月流水_mean_min_差分特征_金融性交易_同名0.0_按月流水', '一阶差分_合约账户余额_金融性交易_转入_按月流水_count_-1_last_差分特征_金融性交易_转入_按月流水', '一阶差分_合约账户余额_金融性交易_对公_按7天流水_mean_-1_mean_差分特征_金融性交易_对公_按7天流水', '合约账户余额_金融性交易_个人_按7天流水_mean_min_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_对公_按7天流水_mean_-1_sum_差分特征_金融性交易_对公_按7天流水', '折人民币交易金额_金融性交易_同名1.0_按7天流水_mean_min_差分特征_金融性交易_同名1.0_按7天流水', '合约账户余额_金融性交易_同名1.0_按月流水_mean_min_差分特征_金融性交易_同名1.0_按月流水', '合约账户余额_金融性交易_少见交易_按月流水_mean_min_差分特征_金融性交易_少见交易_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_-1_mean_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_对公_按月流水_count_-1_last_差分特征_金融性交易_对公_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_7天流水_mean_-1_max_差分特征_金融性交易_记账方向代码164_7天流水', '合约账户余额_金融性交易_跨行0.0_按月流水_mean_min_差分特征_金融性交易_跨行0.0_按月流水', '合约账户余额_金融性交易_同名0.0_按7天流水_mean_min_差分特征_金融性交易_同名0.0_按7天流水', '合约账户余额_金融性交易_对手方行内1_按月流水_mean_sum_差分特征_金融性交易_对手方行内1_按月流水', '折人民币交易金额_金融性交易_同名1.0_按7天流水_mean_mean_差分特征_金融性交易_同名1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按7天流水_sum_-1_last_差分特征_金融性交易_对公_按7天流水', '折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_min_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_合约账户余额_金融性交易_对公_按月流水_mean_-1_max_差分特征_金融性交易_对公_按月流水', '折人民币交易金额_金融性交易_同名1.0_按月流水_mean_min_差分特征_金融性交易_同名1.0_按月流水', '折人民币交易金额_金融性交易_对手方行内1_按月流水_sum_min_差分特征_金融性交易_对手方行内1_按月流水', '合约账户余额_金融性交易_少见交易_按7天流水_sum_min_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_现转标识1_30天流水_mean_-1_mean_差分特征_金融性交易_现转标识1_30天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_mean_-1_last_差分特征_金融性交易_记账方向代码125_15天流水', '合约账户余额_金融性交易_对公_按7天流水_count_get_kurt_差分特征_金融性交易_对公_按7天流水', '合约账户余额_金融性交易_少见交易_按7天流水_mean_min_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_7天流水_mean_-1_std_差分特征_金融性交易_记账方向代码164_7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_7天流水_mean_-1_std_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_同名1.0_按7天流水_sum_min_差分特征_金融性交易_同名1.0_按7天流水', '合约账户余额_金融性交易_跨行1.0_按7天流水_mean_min_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_合约账户余额_金融性交易_转入_按月流水_mean_-1_last_差分特征_金融性交易_转入_按月流水', '折人民币交易金额_金融性交易_记账方向代码125_30天流水_sum_skew_差分特征_金融性交易_记账方向代码125_30天流水', '采样前120天内频率最高两类渠道交易笔数_占比', '折人民币交易金额_金融性交易_对手方行内1_按月流水_sum_skew_差分特征_金融性交易_对手方行内1_按月流水', '合约账户余额_金融性交易_记账方向代码164_15天流水_mean_last_差分特征_金融性交易_记账方向代码164_15天流水', '折人民币交易金额_金融性交易_对公_按7天流水_mean_min_差分特征_金融性交易_对公_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_30天流水_mean_-1_last_差分特征_金融性交易_记账方向代码125_30天流水', '折人民币交易金额_金融性交易_少见交易_按7天流水_mean_max_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_sum_-1_skew_差分特征_金融性交易_记账方向代码125_15天流水', '合约账户余额_金融性交易_常见交易_按月流水_sum_skew_差分特征_金融性交易_常见交易_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_30天流水_mean_-1_max_差分特征_金融性交易_记账方向代码164_30天流水', '折人民币交易金额_金融性交易_少见交易_按7天流水_mean_sum_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按月流水_sum_-1_min_差分特征_金融性交易_同名0.0_按月流水', '合约账户余额_金融性交易_同名0.0_按7天流水_mean_mean_差分特征_金融性交易_同名0.0_按7天流水', '合约账户余额_金融性交易_对公_按7天流水_mean_get_kurt_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_常见交易_按7天流水_sum_-1_max_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_7天流水_sum_-1_last_差分特征_金融性交易_记账方向代码164_7天流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按7天流水_mean_-1_min_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按7天流水_count_-1_skew_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_对公_按7天流水_mean_last_差分特征_金融性交易_对公_按7天流水', '一阶差分_合约账户余额_金融性交易_对公_按月流水_mean_-1_mean_差分特征_金融性交易_对公_按月流水', '折人民币交易金额_金融性交易_同名0.0_按7天流水_mean_std_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_少见交易_按月流水_mean_sum_差分特征_金融性交易_少见交易_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_7天流水_mean_-1_min_差分特征_金融性交易_记账方向代码164_7天流水', '一阶差分_合约账户余额_金融性交易_对公_按7天流水_mean_-1_std_差分特征_金融性交易_对公_按7天流水', '折人民币交易金额_金融性交易_对公_按7天流水_mean_mean_差分特征_金融性交易_对公_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_30天流水_mean_-1_min_差分特征_金融性交易_记账方向代码125_30天流水', '合约账户余额_金融性交易_同名0.0_按月流水_sum_skew_差分特征_金融性交易_同名0.0_按月流水', '折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_get_kurt_差分特征_金融性交易_记账方向代码125_15天流水', '合约账户余额_金融性交易_个人_按月流水_count_skew_差分特征_金融性交易_个人_按月流水', '合约账户余额_金融性交易_同名1.0_按7天流水_mean_mean_差分特征_金融性交易_同名1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按月流水_mean_-1_min_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_30天流水_mean_-1_last_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按月流水_mean_-1_min_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_转入_按月流水_sum_skew_差分特征_金融性交易_转入_按月流水', '一阶差分_合约账户余额_金融性交易_对手方行内1_按月流水_mean_-1_std_差分特征_金融性交易_对手方行内1_按月流水', '合约账户余额_金融性交易_按月流水_count_get_kurt_差分特征_金融性交易_按月流水', '合约账户余额_金融性交易_同名1.0_按7天流水_sum_min_差分特征_金融性交易_同名1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按月流水_mean_-1_std_差分特征_金融性交易_对公_按月流水', '合约账户余额_金融性交易_同名0.0_按7天流水_mean_get_kurt_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_个人_按7天流水_mean_last_差分特征_金融性交易_个人_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_-1_get_kurt_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_-1_mean_差分特征_金融性交易_记账方向代码164_15天流水', '一阶差分_折人民币交易金额_金融性交易_常见交易_按7天流水_mean_-1_std_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_7天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码164_7天流水', '折人民币交易金额_金融性交易_常见交易_按月流水_sum_skew_差分特征_金融性交易_常见交易_按月流水', '一阶差分_折人民币交易金额_金融性交易_对公_按月流水_sum_-1_min_差分特征_金融性交易_对公_按月流水', '合约账户余额_金融性交易_记账方向代码164_15天流水_mean_sum_差分特征_金融性交易_记账方向代码164_15天流水', '折人民币交易金额_金融性交易_对手方行内0_按月流水_sum_last_差分特征_金融性交易_对手方行内0_按月流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按7天流水_sum_-1_get_kurt_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按7天流水_sum_-1_last_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_记账方向代码125_15天流水_mean_sum_差分特征_金融性交易_记账方向代码125_15天流水', '采样前120天内少见渠道交易笔数_占比', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_15天流水_mean_-1_skew_差分特征_金融性交易_记账方向代码164_15天流水', '折人民币交易金额_金融性交易_少见交易_按月流水_mean_last_差分特征_金融性交易_少见交易_按月流水', '折人民币交易金额_金融性交易_个人_按7天流水_sum_get_kurt_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_count_-1_max_差分特征_金融性交易_常见交易_按7天流水', '折人民币交易金额_金融性交易_个人_按月流水_mean_min_差分特征_金融性交易_个人_按月流水', '合约账户余额_金融性交易_记账方向代码125_7天流水_sum_get_kurt_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_同名0.0_按7天流水_sum_min_差分特征_金融性交易_同名0.0_按7天流水', '合约账户余额_金融性交易_个人_按7天流水_mean_mean_差分特征_金融性交易_个人_按7天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_对公_按7天流水', '折人民币交易金额_金融性交易_少见交易_按7天流水_mean_min_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_mean_-1_max_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_15天流水_mean_-1_std_差分特征_金融性交易_记账方向代码164_15天流水', '一阶差分_折人民币交易金额_金融性交易_个人_按7天流水_sum_-1_get_kurt_差分特征_金融性交易_个人_按7天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按月流水_sum_-1_std_差分特征_金融性交易_对公_按月流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按7天流水_sum_-1_std_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_30天流水_sum_-1_sum_差分特征_金融性交易_记账方向代码164_30天流水', '合约账户余额_金融性交易_记账方向代码125_7天流水_mean_get_kurt_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_折人民币交易金额_金融性交易_转入_按月流水_mean_-1_last_差分特征_金融性交易_转入_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_sum_-1_get_kurt_差分特征_金融性交易_记账方向代码125_15天流水', '折人民币交易金额_金融性交易_常见交易_按7天流水_mean_std_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_对公_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_对公_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按7天流水_mean_-1_sum_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_7天流水_mean_-1_min_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_sum_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_-1_std_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_同名0.0_按月流水_mean_min_差分特征_金融性交易_同名0.0_按月流水', '折人民币交易金额_金融性交易_少见交易_按月流水_mean_min_差分特征_金融性交易_少见交易_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_-1_last_差分特征_金融性交易_记账方向代码164_15天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_-1_skew_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_skew_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_转出_按月流水_mean_-1_max_差分特征_金融性交易_转出_按月流水', '一阶差分_折人民币交易金额_金融性交易_跨行1.0_按7天流水_sum_-1_sum_差分特征_金融性交易_跨行1.0_按7天流水', '折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_get_kurt_差分特征_金融性交易_记账方向代码125_15天流水', '折人民币交易金额_金融性交易_跨行1.0_按7天流水_sum_std_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按7天流水_count_-1_max_差分特征_金融性交易_跨行1.0_按7天流水', '折人民币交易金额_金融性交易_对手方行内1_按月流水_mean_mean_差分特征_金融性交易_对手方行内1_按月流水', '折人民币交易金额_金融性交易_对公_按7天流水_sum_last_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_常见交易_按7天流水_mean_-1_last_差分特征_金融性交易_常见交易_按7天流水', '行内_行外转账金额占比', '折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_last_差分特征_金融性交易_记账方向代码125_7天流水', '合约账户余额_金融性交易_记账方向代码125_30天流水_sum_min_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_-1_min_差分特征_金融性交易_记账方向代码125_7天流水', '合约账户余额_金融性交易_常见交易_按月流水_count_skew_差分特征_金融性交易_常见交易_按月流水', '折人民币交易金额_金融性交易_同名1.0_按月流水_mean_last_差分特征_金融性交易_同名1.0_按月流水', '一阶差分_合约账户余额_金融性交易_转入_按7天流水_count_-1_max_差分特征_金融性交易_转入_按7天流水', '一阶差分_合约账户余额_金融性交易_转入_按7天流水_count_-1_min_差分特征_金融性交易_转入_按7天流水', '折人民币交易金额_金融性交易_同名1.0_按月流水_mean_sum_差分特征_金融性交易_同名1.0_按月流水', '合约账户余额_金融性交易_记账方向代码125_7天流水_mean_max_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_-1_min_差分特征_金融性交易_记账方向代码164_15天流水', '一阶差分_折人民币交易金额_金融性交易_转入_按月流水_mean_-1_max_差分特征_金融性交易_转入_按月流水', '折人民币交易金额_金融性交易_同名1.0_按7天流水_sum_last_差分特征_金融性交易_同名1.0_按7天流水', '合约账户余额_金融性交易_对手方行内0_按月流水_mean_sum_差分特征_金融性交易_对手方行内0_按月流水', '折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_last_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_15天流水_mean_-1_min_差分特征_金融性交易_记账方向代码164_15天流水', '折人民币交易金额_金融性交易_少见交易_按月流水_sum_mean_差分特征_金融性交易_少见交易_按月流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按月流水_mean_-1_min_差分特征_金融性交易_同名0.0_按月流水', '折人民币交易金额_金融性交易_个人_按7天流水_mean_max_差分特征_金融性交易_个人_按7天流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按7天流水_sum_-1_last_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_7天流水_mean_-1_get_kurt_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_跨行1.0_按月流水_sum_std_差分特征_金融性交易_跨行1.0_按月流水', '折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_get_kurt_差分特征_金融性交易_记账方向代码125_7天流水', '合约账户余额_金融性交易_少见交易_按月流水_sum_min_差分特征_金融性交易_少见交易_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_7天流水_mean_-1_last_差分特征_金融性交易_记账方向代码164_7天流水', '折人民币交易金额_金融性交易_对公_按月流水_sum_min_差分特征_金融性交易_对公_按月流水', '一阶差分_合约账户余额_金融性交易_钞汇标识0_15天流水_mean_-1_last_差分特征_金融性交易_钞汇标识0_15天流水', '合约账户余额_金融性交易_记账方向代码125_15天流水_mean_last_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按月流水_mean_-1_max_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_同名1.0_按月流水_sum_-1_max_差分特征_金融性交易_同名1.0_按月流水', '折人民币交易金额_金融性交易_对手方行内1_按月流水_mean_sum_差分特征_金融性交易_对手方行内1_按月流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按月流水_sum_-1_min_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_跨行0.0_按月流水_mean_get_kurt_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_sum_-1_max_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_折人民币交易金额_金融性交易_少见交易_按7天流水_mean_-1_std_差分特征_金融性交易_少见交易_按7天流水', '折人民币交易金额_金融性交易_同名0.0_按7天流水_mean_mean_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_sum_-1_get_kurt_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_同名0.0_按7天流水_mean_min_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_mean_-1_get_kurt_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_7天流水_mean_-1_get_kurt_差分特征_金融性交易_记账方向代码164_7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码125_7天流水', '合约账户余额_金融性交易_跨行0.0_按月流水_sum_sum_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_现转标识1_7天流水_mean_-1_sum_差分特征_金融性交易_现转标识1_7天流水', '折人民币交易金额_金融性交易_跨行0.0_按月流水_sum_mean_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按7天流水_mean_-1_mean_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_记账方向代码125_15天流水_sum_get_kurt_差分特征_金融性交易_记账方向代码125_15天流水', '折人民币交易金额_金融性交易_对手方行内1_按月流水_mean_min_差分特征_金融性交易_对手方行内1_按月流水', '折人民币交易金额_金融性交易_同名1.0_按7天流水_mean_max_差分特征_金融性交易_同名1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按7天流水_mean_-1_last_差分特征_金融性交易_对公_按7天流水', '行内转账金额占比', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按月流水_mean_-1_mean_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_个人_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_mean_-1_std_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按7天流水_mean_-1_max_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_转入_按7天流水_count_-1_skew_差分特征_金融性交易_转入_按7天流水', '合约账户余额_金融性交易_对公_按月流水_mean_std_差分特征_金融性交易_对公_按月流水', '一阶差分_折人民币交易金额_金融性交易_现转标识1_15天流水_mean_-1_skew_差分特征_金融性交易_现转标识1_15天流水', '转出金额占比', '一阶差分_折人民币交易金额_金融性交易_对公_按月流水_mean_-1_max_差分特征_金融性交易_对公_按月流水', '合约账户余额_金融性交易_跨行0.0_按月流水_sum_skew_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_跨行1.0_按7天流水_mean_mean_差分特征_金融性交易_跨行1.0_按7天流水', '合约账户余额_金融性交易_记账方向代码125_7天流水_mean_min_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_跨行0.0_按7天流水_sum_std_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_-1_std_差分特征_金融性交易_记账方向代码164_15天流水', '合约账户余额_金融性交易_记账方向代码164_30天流水_mean_min_差分特征_金融性交易_记账方向代码164_30天流水', '折人民币交易金额_金融性交易_跨行1.0_按7天流水_mean_min_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_30天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码164_30天流水', '采样前30天内金融性交易笔数_占比', '一阶差分_合约账户余额_金融性交易_转出_按月流水_mean_-1_last_差分特征_金融性交易_转出_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_30天流水_mean_-1_max_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按7天流水_mean_-1_min_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_转出_按月流水_sum_-1_max_差分特征_金融性交易_转出_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_30天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码125_30天流水', '折人民币交易金额_金融性交易_少见交易_按7天流水_sum_mean_差分特征_金融性交易_少见交易_按7天流水', '折人民币交易金额_金融性交易_同名1.0_按月流水_sum_last_差分特征_金融性交易_同名1.0_按月流水', '折人民币交易金额_金融性交易_对手方行内0_按月流水_sum_min_差分特征_金融性交易_对手方行内0_按月流水', '一阶差分_合约账户余额_金融性交易_钞汇标识0_30天流水_mean_-1_sum_差分特征_金融性交易_钞汇标识0_30天流水', '一阶差分_折人民币交易金额_金融性交易_跨行1.0_按月流水_sum_-1_min_差分特征_金融性交易_跨行1.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码125_15天流水', '折人民币交易金额_金融性交易_记账方向代码125_30天流水_sum_min_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_-1_skew_差分特征_金融性交易_记账方向代码125_15天流水', '折人民币交易金额_金融性交易_转出_按月流水_sum_skew_差分特征_金融性交易_转出_按月流水', '一阶差分_折人民币交易金额_金融性交易_常见交易_按月流水_sum_-1_std_差分特征_金融性交易_常见交易_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_7天流水_sum_-1_mean_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_少见交易_按月流水_mean_mean_差分特征_金融性交易_少见交易_按月流水', '合约账户余额_金融性交易_按月流水_sum_skew_差分特征_金融性交易_按月流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按7天流水_mean_-1_std_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_-1_max_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_个人_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_mean_-1_min_差分特征_金融性交易_常见交易_按7天流水', '折人民币交易金额_金融性交易_个人_按月流水_sum_std_差分特征_金融性交易_个人_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_mean_-1_min_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按7天流水_sum_-1_min_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_转入_按月流水_sum_-1_min_差分特征_金融性交易_转入_按月流水', '一阶差分_折人民币交易金额_金融性交易_同名1.0_按月流水_sum_-1_mean_差分特征_金融性交易_同名1.0_按月流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按7天流水_mean_-1_min_差分特征_金融性交易_同名0.0_按7天流水', '合约账户余额_金融性交易_记账方向代码125_7天流水_mean_mean_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_合约账户余额_金融性交易_常见交易_按月流水_count_-1_max_差分特征_金融性交易_常见交易_按月流水', '折人民币交易金额_金融性交易_常见交易_按7天流水_mean_min_差分特征_金融性交易_常见交易_按7天流水', '合约账户余额_金融性交易_少见交易_按7天流水_sum_last_差分特征_金融性交易_少见交易_按7天流水', '合约账户余额_金融性交易_少见交易_按7天流水_sum_max_差分特征_金融性交易_少见交易_按7天流水', '折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_min_差分特征_金融性交易_记账方向代码125_15天流水', '采样前120天客户_转入_折人民币交易总金额', '一阶差分_折人民币交易金额_金融性交易_转入_按月流水_mean_-1_mean_差分特征_金融性交易_转入_按月流水', '折人民币交易金额_金融性交易_现转标识1_15天流水_mean_min_差分特征_金融性交易_现转标识1_15天流水', '折人民币交易金额_金融性交易_记账方向代码164_30天流水_mean_last_差分特征_金融性交易_记账方向代码164_30天流水', '对公交易金额占比', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_sum_-1_std_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_7天流水_mean_-1_max_差分特征_金融性交易_记账方向代码125_7天流水', '合约账户余额_金融性交易_转入_按7天流水_count_get_kurt_差分特征_金融性交易_转入_按7天流水', '折人民币交易金额_金融性交易_同名0.0_按月流水_sum_skew_差分特征_金融性交易_同名0.0_按月流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_mean_-1_sum_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按7天流水_sum_-1_get_kurt_差分特征_金融性交易_跨行1.0_按7天流水', '合约账户余额_金融性交易_同名1.0_按7天流水_sum_mean_差分特征_金融性交易_同名1.0_按7天流水', '折人民币交易金额_金融性交易_对手方行内0_按月流水_mean_last_差分特征_金融性交易_对手方行内0_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_15天流水_sum_-1_last_差分特征_金融性交易_记账方向代码164_15天流水', '一阶差分_合约账户余额_金融性交易_少见交易_按月流水_mean_-1_max_差分特征_金融性交易_少见交易_按月流水', '合约账户余额_金融性交易_跨行0.0_按月流水_mean_max_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按月流水_mean_-1_mean_差分特征_金融性交易_跨行1.0_按月流水', '折人民币交易金额_金融性交易_对手方行内1_按月流水_mean_max_差分特征_金融性交易_对手方行内1_按月流水', '一阶差分_折人民币交易金额_金融性交易_个人_按7天流水_mean_-1_min_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按月流水_sum_-1_mean_差分特征_金融性交易_同名0.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_常见交易_按7天流水_mean_-1_max_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_转出_按月流水_mean_-1_min_差分特征_金融性交易_转出_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_7天流水_mean_-1_last_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_常见交易_按月流水_mean_sum_差分特征_金融性交易_常见交易_按月流水', '一阶差分_合约账户余额_金融性交易_个人_按7天流水_count_-1_std_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_跨行1.0_按7天流水', '合约账户余额_金融性交易_个人_按7天流水_count_skew_差分特征_金融性交易_个人_按7天流水', '合约账户余额_金融性交易_跨行1.0_按月流水_count_skew_差分特征_金融性交易_跨行1.0_按月流水', '折人民币交易金额_金融性交易_对公_按7天流水_sum_max_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_-1_skew_差分特征_金融性交易_记账方向代码125_15天流水', '合约账户余额_金融性交易_跨行0.0_按7天流水_mean_last_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_记账方向代码125_15天流水_sum_min_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_15天流水_mean_-1_last_差分特征_金融性交易_记账方向代码164_15天流水', '折人民币交易金额_金融性交易_同名0.0_按7天流水_sum_last_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_转入_按月流水_mean_-1_min_差分特征_金融性交易_转入_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_sum_-1_mean_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按月流水_mean_-1_mean_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_对手方行内0_按月流水_mean_min_差分特征_金融性交易_对手方行内0_按月流水', '折人民币交易金额_金融性交易_按月流水_sum_last_差分特征_金融性交易_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_-1_min_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_转出_按月流水_mean_-1_sum_差分特征_金融性交易_转出_按月流水', '一阶差分_合约账户余额_金融性交易_对公_按月流水_mean_-1_min_差分特征_金融性交易_对公_按月流水', '一阶差分_合约账户余额_金融性交易_7天流水_mean_-1_std_差分特征_金融性交易_7天流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按月流水_mean_-1_std_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_少见交易_按月流水_mean_max_差分特征_金融性交易_少见交易_按月流水', '一阶差分_合约账户余额_金融性交易_个人_按月流水_mean_-1_max_差分特征_金融性交易_个人_按月流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按7天流水_count_-1_get_kurt_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_现转标识1_15天流水_mean_last_差分特征_金融性交易_现转标识1_15天流水', '一阶差分_合约账户余额_金融性交易_少见交易_按7天流水_mean_-1_max_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按7天流水_sum_-1_last_差分特征_金融性交易_同名0.0_按7天流水', '合约账户余额_金融性交易_个人_按月流水_mean_min_差分特征_金融性交易_个人_按月流水', '合约账户余额_金融性交易_少见交易_按月流水_mean_max_差分特征_金融性交易_少见交易_按月流水', '合约账户余额_金融性交易_少见交易_按月流水_mean_last_差分特征_金融性交易_少见交易_按月流水', '折人民币交易金额_金融性交易_按月流水_sum_skew_差分特征_金融性交易_按月流水', '一阶差分_折人民币交易金额_金融性交易_现转标识1_7天流水_mean_-1_get_kurt_差分特征_金融性交易_现转标识1_7天流水', '合约账户余额_金融性交易_跨行1.0_按月流水_mean_sum_差分特征_金融性交易_跨行1.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_跨行1.0_按月流水_mean_-1_skew_差分特征_金融性交易_跨行1.0_按月流水', '合约账户余额_金融性交易_对公_按7天流水_mean_min_差分特征_金融性交易_对公_按7天流水', '合约账户余额_金融性交易_转入_按7天流水_count_skew_差分特征_金融性交易_转入_按7天流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按7天流水_count_-1_mean_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_记账方向代码164_15天流水_mean_min_差分特征_金融性交易_记账方向代码164_15天流水', '合约账户余额_金融性交易_记账方向代码125_15天流水_mean_min_差分特征_金融性交易_记账方向代码125_15天流水', '合约账户余额_金融性交易_对公_按月流水_count_get_kurt_差分特征_金融性交易_对公_按月流水', '折人民币交易金额_金融性交易_跨行0.0_按月流水_sum_last_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_mean_-1_max_差分特征_金融性交易_记账方向代码125_15天流水', '合约账户余额_金融性交易_对公_按7天流水_mean_last_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_个人_按7天流水_mean_-1_std_差分特征_金融性交易_个人_按7天流水', '折人民币交易金额_金融性交易_同名0.0_按7天流水_mean_last_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_同名0.0_按月流水_mean_last_差分特征_金融性交易_同名0.0_按月流水', '折人民币交易金额_金融性交易_常见交易_按7天流水_mean_max_差分特征_金融性交易_常见交易_按7天流水', '折人民币交易金额_金融性交易_记账方向代码125_30天流水_mean_last_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_合约账户余额_金融性交易_对公_按月流水_count_-1_min_差分特征_金融性交易_对公_按月流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_mean_-1_mean_差分特征_金融性交易_常见交易_按7天流水', '折人民币交易金额_金融性交易_记账方向代码125_7天流水_sum_min_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按7天流水_count_-1_skew_差分特征_金融性交易_跨行1.0_按7天流水', '折人民币交易金额_金融性交易_跨行0.0_按月流水_sum_skew_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_对公_按月流水_mean_std_差分特征_金融性交易_对公_按月流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按7天流水_mean_-1_sum_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_少见交易_按月流水_sum_-1_std_差分特征_金融性交易_少见交易_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_sum_-1_min_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_合约账户余额_金融性交易_个人_按7天流水_mean_-1_std_差分特征_金融性交易_个人_按7天流水', '折人民币交易金额_金融性交易_同名1.0_按月流水_sum_std_差分特征_金融性交易_同名1.0_按月流水', '折人民币交易金额_金融性交易_同名0.0_按月流水_mean_max_差分特征_金融性交易_同名0.0_按月流水', '折人民币交易金额_金融性交易_跨行0.0_按月流水_sum_min_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_跨行0.0_按7天流水_mean_mean_差分特征_金融性交易_跨行0.0_按7天流水', '折人民币交易金额_金融性交易_常见交易_按月流水_mean_mean_差分特征_金融性交易_常见交易_按月流水', '一阶差分_合约账户余额_金融性交易_同名1.0_按7天流水_mean_-1_sum_差分特征_金融性交易_同名1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按月流水_sum_-1_max_差分特征_金融性交易_对公_按月流水', '一阶差分_折人民币交易金额_金融性交易_对手方行内1_按月流水_mean_-1_std_差分特征_金融性交易_对手方行内1_按月流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按月流水_mean_-1_last_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_转出_按月流水_sum_last_差分特征_金融性交易_转出_按月流水', '合约账户余额_金融性交易_转出_按月流水_count_skew_差分特征_金融性交易_转出_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_30天流水_mean_-1_mean_差分特征_金融性交易_记账方向代码164_30天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按月流水_mean_-1_last_差分特征_金融性交易_对公_按月流水', '合约账户余额_金融性交易_跨行1.0_按7天流水_count_get_kurt_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_30天流水_mean_-1_mean_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_sum_-1_std_差分特征_金融性交易_记账方向代码125_7天流水', '折人民币交易金额_金融性交易_对公_按月流水_sum_sum_差分特征_金融性交易_对公_按月流水', '折人民币交易金额_金融性交易_对手方行内0_按月流水_sum_std_差分特征_金融性交易_对手方行内0_按月流水', '合约账户余额_金融性交易_记账方向代码164_15天流水_sum_min_差分特征_金融性交易_记账方向代码164_15天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_mean_-1_skew_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_7天流水_mean_-1_mean_差分特征_金融性交易_记账方向代码125_7天流水', '合约账户余额_金融性交易_对手方行内1_按月流水_mean_std_差分特征_金融性交易_对手方行内1_按月流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按月流水_sum_-1_mean_差分特征_金融性交易_同名0.0_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_30天流水_mean_-1_last_差分特征_金融性交易_记账方向代码164_30天流水', '一阶差分_合约账户余额_金融性交易_现转标识1_7天流水_mean_-1_max_差分特征_金融性交易_现转标识1_7天流水', '一阶差分_合约账户余额_金融性交易_个人_按月流水_mean_-1_mean_差分特征_金融性交易_个人_按月流水', '一阶差分_合约账户余额_金融性交易_对手方行内1_按月流水_mean_-1_sum_差分特征_金融性交易_对手方行内1_按月流水', '合约账户余额_金融性交易_同名1.0_按月流水_sum_min_差分特征_金融性交易_同名1.0_按月流水', '折人民币交易金额_金融性交易_记账方向代码125_30天流水_mean_sum_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_折人民币交易金额_金融性交易_对手方行内0_按月流水_sum_-1_sum_差分特征_金融性交易_对手方行内0_按月流水', '折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_min_差分特征_金融性交易_记账方向代码164_15天流水', '一阶差分_合约账户余额_金融性交易_转入_按7天流水_count_-1_get_kurt_差分特征_金融性交易_转入_按7天流水', '一阶差分_折人民币交易金额_金融性交易_常见交易_按月流水_mean_-1_max_差分特征_金融性交易_常见交易_按月流水', '一阶差分_合约账户余额_金融性交易_同名1.0_按7天流水_mean_-1_max_差分特征_金融性交易_同名1.0_按7天流水', '折人民币交易金额_金融性交易_跨行1.0_按7天流水_sum_max_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按7天流水_sum_-1_sum_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_15天流水_mean_-1_last_差分特征_金融性交易_记账方向代码164_15天流水', '合约账户余额_金融性交易_跨行0.0_按月流水_mean_std_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按月流水_sum_-1_min_差分特征_金融性交易_同名0.0_按月流水', '合约账户余额_金融性交易_对手方行内1_按月流水_sum_last_差分特征_金融性交易_对手方行内1_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_30天流水_sum_-1_min_差分特征_金融性交易_记账方向代码164_30天流水', '合约账户余额_金融性交易_对手方行内1_按月流水_count_skew_差分特征_金融性交易_对手方行内1_按月流水', '折人民币交易金额_金融性交易_对手方行内0_按月流水_mean_max_差分特征_金融性交易_对手方行内0_按月流水', '合约账户余额_金融性交易_记账方向代码125_15天流水_sum_skew_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_7天流水_mean_-1_std_差分特征_金融性交易_记账方向代码164_7天流水', '合约账户余额_金融性交易_少见交易_按7天流水_mean_last_差分特征_金融性交易_少见交易_按7天流水', '折人民币交易金额_金融性交易_现转标识1_30天流水_sum_skew_差分特征_金融性交易_现转标识1_30天流水', '折人民币交易金额_金融性交易_常见交易_按7天流水_sum_last_差分特征_金融性交易_常见交易_按7天流水', '合约账户余额_金融性交易_跨行0.0_按月流水_sum_min_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_对公_按月流水_mean_last_差分特征_金融性交易_对公_按月流水', '合约账户余额_金融性交易_同名0.0_按7天流水_sum_get_kurt_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_跨行1.0_按7天流水_sum_-1_get_kurt_差分特征_金融性交易_跨行1.0_按7天流水', '合约账户余额_金融性交易_记账方向代码125_7天流水_sum_last_差分特征_金融性交易_记账方向代码125_7天流水', '合约账户余额_金融性交易_同名0.0_按7天流水_sum_last_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_30天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码125_30天流水', '合约账户余额_金融性交易_同名1.0_按7天流水_sum_last_差分特征_金融性交易_同名1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_15天流水_mean_-1_get_kurt_差分特征_金融性交易_15天流水', '一阶差分_折人民币交易金额_金融性交易_对公_按7天流水_mean_-1_min_差分特征_金融性交易_对公_按7天流水', '折人民币交易金额_金融性交易_跨行1.0_按7天流水_sum_last_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_合约账户余额_金融性交易_个人_按7天流水_mean_-1_min_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_个人_按月流水_mean_-1_last_差分特征_金融性交易_个人_按月流水', '合约账户余额_金融性交易_常见交易_按7天流水_sum_min_差分特征_金融性交易_常见交易_按7天流水', '折人民币交易金额_金融性交易_对公_按7天流水_mean_max_差分特征_金融性交易_对公_按7天流水', '合约账户余额_金融性交易_对公_按月流水_sum_min_差分特征_金融性交易_对公_按月流水', '折人民币交易金额_金融性交易_跨行1.0_按月流水_sum_skew_差分特征_金融性交易_跨行1.0_按月流水', '一阶差分_合约账户余额_金融性交易_个人_按月流水_sum_-1_std_差分特征_金融性交易_个人_按月流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_15天流水_sum_-1_sum_差分特征_金融性交易_记账方向代码164_15天流水', '合约账户余额_金融性交易_同名0.0_按7天流水_mean_max_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_跨行0.0_按7天流水_mean_last_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按7天流水_mean_-1_last_差分特征_金融性交易_跨行0.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按7天流水_sum_-1_sum_差分特征_金融性交易_同名0.0_按7天流水', '合约账户余额_金融性交易_跨行1.0_按7天流水_count_skew_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_合约账户余额_金融性交易_对手方行内1_按月流水_mean_-1_last_差分特征_金融性交易_对手方行内1_按月流水', '一阶差分_合约账户余额_金融性交易_对公_按7天流水_mean_-1_min_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_7天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码164_7天流水', '折人民币交易金额_金融性交易_个人_按月流水_mean_std_差分特征_金融性交易_个人_按月流水', '一阶差分_折人民币交易金额_金融性交易_转出_按月流水_mean_-1_last_差分特征_金融性交易_转出_按月流水', '合约账户余额_金融性交易_对公_按月流水_sum_skew_差分特征_金融性交易_对公_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_30天流水_mean_-1_min_差分特征_金融性交易_记账方向代码164_30天流水', '合约账户余额_金融性交易_对手方行内0_按月流水_sum_last_差分特征_金融性交易_对手方行内0_按月流水', '折人民币交易金额_金融性交易_个人_按7天流水_mean_mean_差分特征_金融性交易_个人_按7天流水', '一阶差分_折人民币交易金额_金融性交易_对手方行内1_按月流水_mean_-1_sum_差分特征_金融性交易_对手方行内1_按月流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按月流水_mean_-1_sum_差分特征_金融性交易_同名0.0_按月流水', '折人民币交易金额_金融性交易_同名0.0_按月流水_mean_get_kurt_差分特征_金融性交易_同名0.0_按月流水', '折人民币交易金额_金融性交易_个人_按月流水_sum_get_kurt_差分特征_金融性交易_个人_按月流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按月流水_mean_-1_max_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_sum_-1_sum_差分特征_金融性交易_常见交易_按7天流水', '折人民币交易金额_金融性交易_对公_按7天流水_sum_min_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_7天流水_sum_-1_sum_差分特征_金融性交易_记账方向代码164_7天流水', '合约账户余额_金融性交易_跨行1.0_按月流水_mean_min_差分特征_金融性交易_跨行1.0_按月流水', '一阶差分_合约账户余额_金融性交易_对公_按月流水_mean_-1_std_差分特征_金融性交易_对公_按月流水', '折人民币交易金额_金融性交易_少见交易_按月流水_sum_min_差分特征_金融性交易_少见交易_按月流水', '一阶差分_折人民币交易金额_金融性交易_对公_按月流水_sum_-1_last_差分特征_金融性交易_对公_按月流水', '合约账户余额_金融性交易_对手方行内0_按月流水_mean_max_差分特征_金融性交易_对手方行内0_按月流水', '一阶差分_折人民币交易金额_金融性交易_转出_按月流水_sum_-1_min_差分特征_金融性交易_转出_按月流水', '一阶差分_折人民币交易金额_金融性交易_常见交易_按7天流水_sum_-1_last_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_折人民币交易金额_金融性交易_跨行0.0_按7天流水_mean_-1_max_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_转入_按月流水_count_skew_差分特征_金融性交易_转入_按月流水', '一阶差分_合约账户余额_金融性交易_跨行1.0_按7天流水_mean_-1_min_差分特征_金融性交易_跨行1.0_按7天流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按7天流水_mean_-1_max_差分特征_金融性交易_同名0.0_按7天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码125_15天流水_mean_-1_sum_差分特征_金融性交易_记账方向代码125_15天流水', '折人民币交易金额_金融性交易_同名1.0_按月流水_sum_min_差分特征_金融性交易_同名1.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_-1_max_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_钞汇标识0_15天流水_mean_-1_last_差分特征_金融性交易_钞汇标识0_15天流水', '折人民币交易金额_金融性交易_对公_按7天流水_sum_mean_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_30天流水_sum_-1_last_差分特征_金融性交易_记账方向代码164_30天流水', '一阶差分_合约账户余额_金融性交易_记账方向代码164_30天流水_mean_-1_std_差分特征_金融性交易_记账方向代码164_30天流水', '合约账户余额_金融性交易_记账方向代码125_30天流水_sum_last_差分特征_金融性交易_记账方向代码125_30天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_-1_std_差分特征_金融性交易_记账方向代码125_15天流水', '折人民币交易金额_金融性交易_对公_按月流水_sum_skew_差分特征_金融性交易_对公_按月流水', '一阶差分_折人民币交易金额_金融性交易_跨行1.0_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_跨行1.0_按7天流水', '合约账户余额_金融性交易_常见交易_按7天流水_mean_min_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码125_15天流水_sum_-1_get_kurt_差分特征_金融性交易_记账方向代码125_15天流水', '一阶差分_折人民币交易金额_金融性交易_转入_按月流水_sum_-1_mean_差分特征_金融性交易_转入_按月流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按7天流水_sum_-1_mean_差分特征_金融性交易_跨行0.0_按7天流水', '合约账户余额_金融性交易_记账方向代码125_7天流水_sum_min_差分特征_金融性交易_记账方向代码125_7天流水', '一阶差分_合约账户余额_金融性交易_按月流水_mean_-1_sum_差分特征_金融性交易_按月流水', '合约账户余额_金融性交易_跨行1.0_按7天流水_count_mean_差分特征_金融性交易_跨行1.0_按7天流水', '折人民币交易金额_金融性交易_记账方向代码164_30天流水_sum_std_差分特征_金融性交易_记账方向代码164_30天流水', '一阶差分_折人民币交易金额_金融性交易_个人_按7天流水_sum_-1_max_差分特征_金融性交易_个人_按7天流水', '一阶差分_合约账户余额_金融性交易_跨行0.0_按月流水_mean_-1_last_差分特征_金融性交易_跨行0.0_按月流水', '折人民币交易金额_金融性交易_跨行0.0_按月流水_mean_min_差分特征_金融性交易_跨行0.0_按月流水', '一阶差分_合约账户余额_金融性交易_对公_按7天流水_sum_-1_get_kurt_差分特征_金融性交易_对公_按7天流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按月流水_mean_-1_skew_差分特征_金融性交易_同名0.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_同名0.0_按7天流水_mean_-1_get_kurt_差分特征_金融性交易_同名0.0_按7天流水', '折人民币交易金额_金融性交易_同名1.0_按7天流水_mean_last_差分特征_金融性交易_同名1.0_按7天流水', '一阶差分_合约账户余额_金融性交易_少见交易_按7天流水_mean_-1_std_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_-1_max_差分特征_金融性交易_记账方向代码164_15天流水', '折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_last_差分特征_金融性交易_记账方向代码164_15天流水', '折人民币交易金额_金融性交易_个人_按月流水_sum_min_差分特征_金融性交易_个人_按月流水', '一阶差分_合约账户余额_金融性交易_对公_按月流水_count_-1_std_差分特征_金融性交易_对公_按月流水', '一阶差分_合约账户余额_金融性交易_常见交易_按7天流水_sum_-1_mean_差分特征_金融性交易_常见交易_按7天流水', '合约账户余额_金融性交易_少见交易_按7天流水_mean_sum_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_少见交易_按7天流水_sum_-1_sum_差分特征_金融性交易_少见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_转入_按月流水_mean_-1_std_差分特征_金融性交易_转入_按月流水', '合约账户余额_金融性交易_钞汇标识0_15天流水_mean_min_差分特征_金融性交易_钞汇标识0_15天流水', '折人民币交易金额_金融性交易_记账方向代码125_15天流水_mean_last_差分特征_金融性交易_记账方向代码125_15天流水', '合约账户余额_金融性交易_少见交易_按月流水_mean_mean_差分特征_金融性交易_少见交易_按月流水', '一阶差分_折人民币交易金额_金融性交易_对手方行内0_按月流水_sum_-1_min_差分特征_金融性交易_对手方行内0_按月流水', '合约账户余额_金融性交易_对手方行内0_按月流水_sum_std_差分特征_金融性交易_对手方行内0_按月流水', '合约账户余额_金融性交易_按月流水_count_last_差分特征_金融性交易_按月流水', '折人民币交易金额_金融性交易_记账方向代码125_30天流水_mean_std_差分特征_金融性交易_记账方向代码125_30天流水', '折人民币交易金额_金融性交易_记账方向代码164_15天流水_sum_mean_差分特征_金融性交易_记账方向代码164_15天流水', '合约账户余额_金融性交易_同名1.0_按月流水_mean_last_差分特征_金融性交易_同名1.0_按月流水', '一阶差分_折人民币交易金额_金融性交易_个人_按月流水_sum_-1_min_差分特征_金融性交易_个人_按月流水', '折人民币交易金额_金融性交易_跨行1.0_按月流水_mean_last_差分特征_金融性交易_跨行1.0_按月流水', '折人民币交易金额_金融性交易_15天流水_sum_min_差分特征_金融性交易_15天流水', '一阶差分_合约账户余额_金融性交易_同名0.0_按月流水_count_-1_min_差分特征_金融性交易_同名0.0_按月流水', '合约账户余额_金融性交易_常见交易_按7天流水_mean_std_差分特征_金融性交易_常见交易_按7天流水', '一阶差分_合约账户余额_金融性交易_转出_按月流水_sum_-1_mean_差分特征_金融性交易_转出_按月流水', '一阶差分_合约账户余额_金融性交易_个人_按月流水_mean_-1_min_差分特征_金融性交易_个人_按月流水', ]\n",
    "df[[\"客户编号\"] + feas_keep_462].to_pickle(\"/home/mole/work/xukunzhou/复现/A榜/data/数据还原_金融性交易明细_全部特征相关性剔除后保留463.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "343a7bbb-66cf-4dcf-ad19-14c26e263caf",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2024-11-11T01:11:42.147305Z",
     "iopub.status.busy": "2024-11-11T01:11:42.146454Z",
     "iopub.status.idle": "2024-11-11T01:11:42.242609Z",
     "msg_id": "125cf976-646b-43fd-baed-e38241fc7145",
     "shell.execute_reply": "2024-11-11T01:11:42.241746Z",
     "shell.execute_reply.started": "2024-11-11T01:11:42.147273Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_463 = pd.read_pickle(\"/home/mole/work/xukunzhou/复现/A榜/data/数据还原_金融性交易明细_全部特征相关性剔除后保留463.pkl\")\n",
    "\n",
    "# o_df_463 = pd.read_pickle(\"/home/mole/work/xukunzhou/20241030/data/金融性交易明细_全部特征相关性剔除后保留463.pkl\").drop(columns=[\"FLAG\"])\n",
    "\n",
    "# df_463.equals(o_df_463)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "67bec60e-72dc-486f-a687-ea535b130389",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
